{% extends "templates/panoptic_base.html" %}

{% block content %}
<section class="container border-b">
	{{ web_block(
		"Title Section",
		values={
			"title": authority,
			"subtitle": subtitle
		},
		add_container=0,
		add_top_padding=0,
		add_bottom_padding=0,
	) }}
	<!-- <div class="border-l border-r bg-panoptic-blue-500">
		{% if amount_spent %}
		<div class="px-4 md:px-8 py-5 border-l md:border-l-0 border-b">
			<p class="uppercase font-semibold tracking-wider text-sm text-orange-500">Amount Spent</p>
			<p class="text-5xl font-bold text-white">{{ frappe.utils.fmt_money(amount_spent, 0, "INR") }}</p>
		</div>
		{% endif %}
	</div> -->
	<div class="flex flex-wrap mx-auto bg-panoptic-blue-500 border-l border-r p-5 md:p-8 lg:p-12">
		<div class="w-full md:w-1/3 pr-12">
			<h3 class="text-orange-500">Overview</h3>
			<div class="mt-4">
				<div class="mb-2">
					Place: <b>{{ district_name }}</b>
				</div>
				<div class="mb-2">
					Purpose: <b>{{ purpose }}</b>
				</div>
				<div class="mb-2">
					Financial Outlay: <b>{{ frappe.utils.fmt_money(amount_spent, 0, "INR") if amount_spent else "Not Available" }}</b>
					{% if amount_spent %}
					<p class='text-sm text-teal-blue-300'>Estimates based on available information</p>
					{% endif %}
				</div>
				<div class="mb-2">
					Technology Partner: <b>{{ technology_provider or "Not Available" }}</b>
				</div>
				<div class="mb-2">
					Date of Tender Publishing: <b>{{ tender_publish_date or "Not Available" }}</b>
				</div>
				<div class="mb-2">
					Date of Reported Use: <b>{{ reported_use_date or "Not Available" }}</b>
				</div>
				<div class="mb-2">
					Status: <b>{{ status or "Not Available" }}</b>
				</div>
				<div class="mb-2">
					Storage Duration: <b>{{ storage_duration or "Not Available" }}</b>
				</div>
				<div class="mb-2">
					Prescribed Standards: <b>{{ prescribed_technical_standards or "Not Available" }}</b>
				</div>
				{%- if parent_frt and parent and parent.published -%}
				<div class="mb-2">
					Parent Project: <a href="/{{ parent.route }}" class="underline"><b>{{ parent.name }}</b></a>
				</div>
				{%- endif -%}
			</div>
			{% if is_group and child_frts|length %}
			<div class="mt-8">
				<h3 class="text-orange-500">FRTs Under this Project</h3>
				<div class="mt-4">
					{% for frt in child_frts %}
					<div class="mb-2">
						<a class="underline" href="/{{ frt.route }}">{{ frt.name }}, {{ frt.authority }}</a>
					</div>
					{% endfor %}
				</div>
			</div>
			{% endif %}
		</div>
		{% if rti|length or case_studies|length or legal_basis|length or frt_legal_basis|length or linked|length %}
		<div class="w-full md:w-1/3 pr-12 md:-mt-8">
			{% if rti|length %}
			<div class="mt-8">
				<h3 class="text-orange-500">Right to Information</h3>
				<div class="mt-4">
					{% for application in rti_list %}
					<div class="mb-2">
						<a class="underline" href="/{{ application.route }}">{{ application.title }}</a>
					</div>
					{% endfor %}
				</div>
			</div>
			{% endif %}
			{% if case_studies|length %}
			<div class="mt-8">
				<h3 class="text-orange-500">Case Studies</h3>
				<div class="mt-4">
					{% for study in case_studies %}
					<div class="mb-2">
						<a class="underline" href="/{{ study.route }}">{{ study.title }}</a>
					</div>
					{% endfor %}
				</div>
			</div>
			{% endif %}
			{% if legal_basis|length or frt_legal_basis|length %}
			<div class="mt-8">
				<h3 class="text-orange-500">Legal Basis</h3>
				<div class="mt-4">
					{% for basis in frt_legal_basis %}
					<div class="mb-2">
						{% if basis.url %}
						<a class="underline" target="_blank" rel="noopener noreferrer"
							href="{{ basis.url }}">{{ basis.title }}</a>
						{% else %}
						{{ basis.title }}
						{% endif %}
					</div>
					{% endfor %}
					{% for case in legal_basis %}
					<div class="mb-2">
						{{ case.title }}, {{ case.year }}
					</div>
					{% endfor %}
				</div>
			</div>
			{% endif %}
			{% if linked|length %}
			<div class="mt-8">
				<h3 class="text-orange-500">Linked Database</h3>
				<div class="mt-4">
					{% for db in linked %}
					<div class="mb-2">
						{{ db.linked_database }}
					</div>
					{% endfor %}
				</div>
			</div>
			{% endif %}
		</div>
		{% endif %}
		<div class="w-full md:w-1/3 pr-12 md:-mt-8">
			{% if government_link and government_link_title %}
			<div class="mt-8">
				<h3 class="text-orange-500">Government Link</h3>
				<div class="mt-4">
					<a class="underline" target="_blank" rel="noopener noreferrer"
						href="{{ government_link }}">{{ government_link_title }}</a>
				</div>
			</div>
			{% endif %}

			{% if news_links %}
			<div class="mt-8">
				<h3 class="text-orange-500">Media Links</h3>
				<div class="mt-4">
					{% for link in links %}
					{% if link.type == "News Article" %}
					<div class="mb-2">
						<a target="_blank" rel="noopener noreferrer" class="underline"
							href="{{ link.link }}">{{ link.title }}</a>
					</div>
					{% endif %}
					{% endfor %}
				</div>
			</div>
			{% endif %}
			{% set attachment = frappe.db.get_value("FRT Technology Provider", technology_provider, "attachment") %}
			{% if other_links or attachment %}
			<div class="mt-8">
				<h3 class="text-orange-500">Other Links</h3>
				<div class="mt-4">
					{% if attachment %}
					<div class="mb-2">
						<a target="_blank" rel="noopener noreferrer" class="underline"
							href="{{ attachment }}">{{ technology_provider }}</a>
					</div>
					{% endif %}
					{% for link in links %}
					{% if link.type != "News Article" %}
					<div class="mb-2">
						<a target="_blank" rel="noopener noreferrer" class="underline"
							href="{{ link.link }}">{{ link.title }}</a>
					</div>
					{% endif %}
					{% endfor %}
				</div>
			</div>
			{% endif %}

			<div class="mt-8">
				<h3 class="text-orange-500">Share This FRT</h3>
				<div class="mt-4">
					<a href="https://twitter.com/intent/tweet?text=Know more about the Facial Recognition system installed by {{ title }} %23ProjectPanoptic&url={{ site_url }}/{{ route }}"
						class="text-teal-blue-200 fa fa-twitter" target="_blank"></a>

					<a href="https://www.facebook.com/sharer.php?u={{ site_url }}/{{ route }}"
						class="text-teal-blue-200 ml-2 fa fa-facebook" target="_blank"></a>

					<a href="https://www.linkedin.com/sharing/share-offsite/?url={{ site_url }}/{{ route }}"
						class="text-teal-blue-200 ml-2 fa fa-linkedin" target="_blank"></a>

					<a href="mailto:?subject=ProjectPanoptic {{ title }}&body={{ site_url }}/{{ route }}"
						class="text-teal-blue-200 ml-2 fa fa-envelope" target="_blank"></a>
				</div>
			</div>
		</div>

	</div>
	</div>
</section>
{% if frts|length %}
<section class="container bg-teal-blue-500 border-l border-r border-b flex flex-wrap">
	<div class="bg-panoptic-blue-500 border-b w-full px-8 py-5 flex justify-between">
		<div class="font-bold">Other FRTs around {{ district_name }}</div>
		<a href="/{{ state_route }}" class="text-aqua-blue-500 text-right">View All in {{ state }}</a>
	</div>
	{% for frt in frts[:3] %}
	<a href="/{{ frt.route }}"
		class="w-full md:w-1/3 lg:w-1/3 p-8 border-r border-b hover:bg-teal-blue-600 hover:text-orange-500">
		<h2>{{ frt.authority }}</h2>
		<div class="mt-3 mb-3 text-white">
			<!-- {%- if frt.district_name -%}
			<p><span class="text-teal-blue-300">District:</span> {{ frt.district_name }}</p>
			{%- endif -%} -->

			{%- if frt.status -%}
			<p><span class="text-teal-blue-300">Status:</span> {{ frt.status }}</p>
			{%- endif -%}

			{%- if frt.purpose -%}
			<p><span class="text-teal-blue-300">Purpose:</span> {{ frt.purpose }}</p>
			{%- endif -%}

		</div>
	</a>
	{% endfor %}
</section>
{% endif %}
{% endblock %}
